package com.example.aerospacemanagementsystem.controller.basic;

import com.example.aerospacemanagementsystem.entity.basic.Menu;
import com.example.aerospacemanagementsystem.service.basicService.MenuService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 铁殷
 */

@Api(tags = "菜单")
@RestController
@CrossOrigin
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;

    //添加菜单
    @PostMapping
    public int add(@RequestBody Menu menu){
        return menuService.add(menu);
    }
    //删除菜单
    @DeleteMapping
    public int delete(Menu menu){
        return menuService.delete(menu);
    }
    //修改菜单
    @PutMapping
    public int update(@RequestBody Menu menu){
        return menuService.update(menu);
    }
    //获取菜单
    @GetMapping("/getAll")
    public List<Menu> getAllCity(Menu menu) {
        List<Menu> list = menuService.getAllMenu(menu);
        return list;
    }
}
